package com.taa.domain.trade.service.chain.factory;

import com.taa.domain.trade.adapter.repository.ITradeRepository;
import com.taa.domain.trade.service.chain.IValidationChain;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Author: taa
 * @Desc:
 * @Create: 2025-06-01 20:57
 **/
@Service
public class DefaultChainFactory {

    private final Map<String, IValidationChain> validationChainGroup;

    protected final ITradeRepository repository;

    public DefaultChainFactory(Map<String, IValidationChain> validationChainGroup, ITradeRepository repository) {
        this.validationChainGroup = validationChainGroup;
        this.repository = repository;
    }

    public IValidationChain getChain() {
        IValidationChain validationChain = validationChainGroup.get("black_list");
        IValidationChain cur = validationChain;
        cur = cur.appendNext(validationChainGroup.get("stock"));
        cur.appendNext(validationChainGroup.get("default"));
        return validationChain;
    }
}

